<div id="tranlsations_module">
	<div class="section_title">
		<% unless @translation_key.locked? %>
	    <div class="tr8n_fltr" style="font-size: 12px; font-weight:normal;">
	      <%= link_to_function(tra("+ add translation"), "addTranslation()") %>
	    </div> 
    <% end %>
				
    <div  class="tr8n_txtl">    
      <%=tr8n_toggler_tag("translations_content")%>
  	  <%=tra("Translations") %>
  		<a name="translations">&nbsp;</a>
    </div>
	</div>
	
  <div class="section tr8n_txtl" id="translations_content">
    <div class="section blue tr8n_txtl">
      <%= form_tag({}, {:method => :get, :id => "translations_search_form"}) do %>
         <%=hidden_field_tag(:section_key, @section_key) %>
         <%=hidden_field_tag(:translation_key_id, @translation_key.id) %>
         <div class="tr8n_txtl" style="padding-top:5px;">
            <%=tra("Show", "Show translations")%>
            <%=select_tag(:with_status, options_for_select(Tr8n::Translation.filter_status_options, params[:with_status]), :onChange => "Tr8n.Effects.submit('translations_search_form')")%>
            <%=tra("submitted by", "Translations subbmitted by")%>
            <%=select_tag(:submitted_by, options_for_select(Tr8n::Translation.filter_submitter_options, params[:submitted_by]), :onChange => "Tr8n.Effects.submit('translations_search_form')")%>
            <%=tra("created on", "Translations created on")%>
            <%=select_tag(:submitted_on, options_for_select(Tr8n::Translation.filter_date_options, params[:submitted_on]), :onChange => "Tr8n.Effects.submit('translations_search_form')")%>
            <%=tra("grouped by", "Translations grouped by")%>
            <%=select_tag(:grouped_by, options_for_select(Tr8n::Translation.filter_group_by_options, params[:grouped_by]), :onChange => "Tr8n.Effects.submit('translations_search_form')")%>
         </div>
      <% end %>
    </div>
    
  <% if @grouping.empty? %>
      <%= render :partial => "/tr8n/translations/list", :locals => {:language => tr8n_current_language, :translations => @translations, :mode => :view} %>
  <% else %>
      <% @grouping.keys.sort.each_with_index do |key, index| %>
        <div class="section_title">
          <% if params[:grouped_by] == "context" %>
            <div style="float:right; font-size: 12px; font-weight:normal; padding-top:5px;">
              <%= link_to_function(trla("+ add translation"), "addTranslation()") %>
            </div> 
          <% end %>
          
          <%=tr8n_toggler_tag("translations_section_#{index}", "", true)%>
					<span style="font-size:14px;">
            <%=key.html_safe %>
					</span>
        </div>
        <div id="translations_section_<%=index%>">
          <%= render :partial => "/tr8n/translations/list", :locals => {:language => tr8n_current_language, :translations => @grouping[key], :mode => :view} %>
        </div>
      <% end %>
  <% end %>
  
  <% unless @translation_key.locked? %>
    <div class="tr8n_txtl" style="font-size: 12px; color: grey; padding-top:15px; padding-bottom:15px;">
    <%= tra("You can only edit or delete translations submitted by you.") %>
     
    <%= tra("If you don't like any of the translations for this phrase, [link: add your own translation].", nil, :link => lambda{|str| link_to_function(str, "addTranslation()")}) %>

    <% if @translation_key.permutatable? %>
        <%=tra("If this translation depends on a {token} or a gender of the viewing user, then [link: generate context rules for this phrase].", nil,
              :token => "{token}", :link => lambda{|str| link_to_function(str, "addContextRules()")}) %>
    <% end %>        
    </div>
  <% end %>

  </div>
</div>